package spil;

import desktop_resources.GUI;

public class Tax extends Field {
	protected int taxAmount;
	
	public Tax(int taxAmount, int fieldNumber) {
		super(fieldNumber);
		
		this.taxAmount = taxAmount;
	}
	
	public void landOnField(Player p) {
		boolean flat = false;
		flat = GUI.getUserLeftButtonPressed("Vil du betaler det flade belød på " + taxAmount + " eller 10% af din pengebeholdning?", "fladt", "procent");
		if(flat) {
			if(p.getBalance() >= taxAmount) {
				GUI.getUserButtonPressed(p+" betaler " + taxAmount, "ok");
				p.getAccount().withdraw(taxAmount);
			}
			else {
				GUI.getUserButtonPressed(p+" betaler " + p.getBalance(), "ok");
				p.getAccount().withdraw(p.getBalance());
			}
		}
		else {
			GUI.getUserButtonPressed(p+" betalte " + (int)(p.getBalance()*0.1), "ok");
			p.getAccount().withdraw((int)(p.getBalance()*0.1));
		}
	}
}
